package test.utils;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : example
 * @ Author: XuLeHuang
 * @ Date: 2022/6/8 17:07
 * @ Description:
 */
public class FileUtil {
    public static void close(RandomAccessFile randomAccessFile) throws IOException {
        randomAccessFile.close();
    }

    public static String getExtension(String toFileNewName) {
        return toFileNewName.substring(toFileNewName.lastIndexOf(".") + 1);
    }

    public static String withoutHeadAndTailDiagonal(String path) {
        return path.substring(0 , path.lastIndexOf("\\") + 1);
    }
}
